home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 301-325 / disk_319 / cnewssrc / cnews.src.lzh / input / rnews < prev    next >
Text File  |  1980-01-01  |  1KB  |  42 lines

  1. #! /bin/sh
  2. # Incoming-news spooling.
  3. # We ignore arguments -- it looks tempting to put "$*" after cat and
  4. # newsspool, but there are security problems.
  5.  
  6. # =()<. ${NEWSCONFIG-@<NEWSCONFIG>@}>()=
  7. . ${NEWSCONFIG-/usr/lib/news/bin/config}
  8.  
  9. PATH=$NEWSCTL/bin:$NEWSBIN/input:$NEWSBIN:$NEWSPATH ; export PATH
  10. umask $NEWSUMASK
  11.  
  12. # check space, assuming a pretty large batch (no cheap way to find real size)
  13. counter=1
  14. while test " `spacefor 250000 incoming`" -le 0
  15. do
  16.     sleep 300
  17.     if test " $counter" -gt 1111        # four tries is plenty
  18.     then
  19.         # oh no! -- nothing we can do, really...
  20.         cat >/dev/null
  21.         echo incoming news discarded due to space shortage |
  22.                             mail "$NEWSMASTER"
  23.         exit 1
  24.     fi
  25.     counter="1$counter"
  26. done
  27.  
  28. if newsspool >/tmp/ngripe.$$ 2>&1        # qqq (marker for Makefile)
  29. then
  30.     rm -f /tmp/ngripe.$$
  31.     exit 0
  32. else
  33.     # there really isn't any way to save the data if newsspool fails,
  34.     # not without causing other problems
  35.     (
  36.         echo newsspool failed!!!
  37.         cat /tmp/ngripe.$$
  38.     ) | mail "$NEWSMASTER"
  39.     rm -f /tmp/ngripe.$$
  40.     exit 1
  41. fi
  42.